package org.zgflex.desktop.selection
{
	import flash.display.Graphics;
	import flash.geom.Rectangle;
	
	import org.zgflex.desktop.IIconSelector;

	/**
	 * A selection renderer that draws a rectangle behind each selected icon.
	 * @param target
	 * 
	 */	
	public class SquareSelectionRenderer extends SelectionRendererBase
	{
		/**
		 * Constructor 
		 * @param target A reference to desktop.
		 * 
		 */		
		public function SquareSelectionRenderer(target:IIconSelector = null)
		{
			super(target);
		}
		
		/**
		 * @inheritDoc
		 * 
		 */		
		override protected function draw(rect:Rectangle):void {			
			var g:Graphics = surface.graphics;
			g.lineStyle(borderWidth, borderColor, borderAlpha);
			g.beginFill(backgroundColor, backgroundAlpha);
			g.drawRect(rect.x, rect.y, rect.width, rect.height);
			g.endFill();
		}
	}
}